package com.ming.attendance.controller;

import com.ming.attendance.po.ResponseBean;
import com.qiniu.util.Auth;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/Upload")
public class UploadController {

    @GetMapping("/getToken")
    public ResponseBean<String> getToken(){
        // 验证七牛云身份是否通过
        String accessKey = "4_8mvpNSxwP0UbLhPV6CFK0cHmOf6mY51d0R6sj0";
        String secretKey = "BFNhbLJqDP3vEDSn7lCq4nEzqNTKjJS-kUR9mqfX";
        Auth auth = Auth.create(accessKey, secretKey);
        // 生成凭证
        String uploadToken = auth.uploadToken("attendance-picture-store");
        return new ResponseBean<>(uploadToken);
    }
}
